using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BookingDB.Models.Mapping
{
    public class CityMap : EntityTypeConfiguration<EntityCity>
    {
        public CityMap()
        {
            // Primary Key
            this.HasKey(t => t.postalCodeID);

            // Properties
            this.Property(t => t.postalCodeID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.cityName)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("City");
            this.Property(t => t.postalCodeID).HasColumnName("postalCodeID");
            this.Property(t => t.cityName).HasColumnName("cityName");
        }
    }
}
